# Plot of question and responses for alcohol
# Create ggplot object
gg_plot <- cleaned_alc_2007 %>%
ggplot(aes(x = question, fill = response)) +
geom_bar(position = "dodge") +
labs(title = "Questions and Responses", x = "Questions", y = "Count") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 5, size = 2)) +
labs(
x = "Question",
y = "Response",
title = "Questions vs Response of Alcohol Consumption"
)
# Extract data directly from the original data frame
plot_data <- cleaned_alc_2007 %>%
group_by(question, response) %>%
summarize(count = n())
## `summarise()` has grouped output by 'question'. You can override using the
## `.groups` argument.
# Convert data to Plotly
plot_ly(data = plot_data, x = ~question, y = ~count, color = ~response, type = "bar", split = ~response) %>%
layout(
title = "Questions vs Response of Alcohol Consumption",
xaxis = list(title = "Question",tickfont = list(size = 5)),
yaxis = list(title = "Response"),
barmode = "stack"
)
<<<<<<< HEAD
# plot showing infant mortality rate vs alcohol consumption
ggplot() +
geom_point(data = cleaned_alc_2007, aes(x = question, y = response), color = "blue", size = 3) +
geom_point(data = cleaned_infant_mortality, aes(x = question, y = response), color = "red", size = 3) +
labs(title = "Scatter Plot of Two Variables from Different Datasets",
x = "X-axis Label",
y = "Y-axis Label") +
theme_minimal()

plot_ly() %>%
add_trace(data = cleaned_alc_2007, type = "scatter", mode = "markers",
x = ~question, y = ~response, marker = list(color = "blue", size = 3)) %>%
add_trace(data = cleaned_infant_mortality, type = "scatter", mode = "markers",
x = ~question, y = ~response, marker = list(color = "red", size = 3)) %>%
layout(title = "Scatter Plot of Two Variables from Different Datasets",
xaxis = list(title = "X-axis Label", tickfont = list(size = 8)),
yaxis = list(title = "Y-axis Label"),
showlegend = FALSE)
=======
>>>>>>> c4895062fb48c9bff81bb25130729b55b27dc5c2
Plot 2: Tobacco Plots
>>>>>>> 41ca2b4a46d7b7352482b3a6a81683f51f66edd5library(ggplot2)
library(plotly)
library(dplyr)
# Assuming cleaned_tobac_2007 is a data frame
# If not, convert it to a data frame using as.data.frame()
# Create ggplot object
gg_plot <- cleaned_tobac_2007 %>%
ggplot(aes(x = location_abbr, fill = response)) +
geom_bar(position = "dodge") +
labs(title = "Questions and Responses", x = "Questions", y = "Count") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(
x = "Question",
y = "Response",
title = "Tobacco Use by State"
)
# Extract data directly from the original data frame
plot_data <- cleaned_tobac_2007 %>%
group_by(location_abbr, response) %>%
summarize(count = n())
## `summarise()` has grouped output by 'location_abbr'. You can override using the
## `.groups` argument.
# Convert data to Plotly
plot_ly(data = plot_data, x = ~location_abbr, y = ~count, color = ~response, type = "bar", split = ~response) %>%
layout(
title = " Tobacco Use by State",
xaxis = list(title = "Question"),
yaxis = list(title = "Response"),
barmode = "stack"
)
<<<<<<< HEAD
cleaned_tobac_2007 |>
ggplot(aes(x = question, fill = response)) +
geom_bar(position = "dodge") +
labs(title = "Questions and Responses", x = "Questions", y = "Count") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 2)) + # Adjust the size parameter
labs(
x = "Question",
y = "Response",
title = "Questions vs Response of Tobacco Use"
)

Plot 3: No Consumption in relation to Infant Mortality
======= >>>>>>> c4895062fb48c9bff81bb25130729b55b27dc5c2 >>>>>>> 41ca2b4a46d7b7352482b3a6a81683f51f66edd5leaflet() |>
addTiles() |>
addCircleMarkers(data = cleaned_alc_2007,
lng = ~longitude, # Adjust column name if needed
lat = ~latitude, # Adjust column name if needed
label = ~location_abbr, # Assuming 'Group.1' is a column in your data
radius = ~data_value * 0.12,
color = "blue",
stroke = TRUE,
fillOpacity = 0.1,
popup = ~paste("Response:", response))
<<<<<<< HEAD
=======
<<<<<<< HEAD
=======
>>>>>>> c4895062fb48c9bff81bb25130729b55b27dc5c2
>>>>>>> 41ca2b4a46d7b7352482b3a6a81683f51f66edd5
leaflet() %>%
addTiles() %>%
addCircleMarkers(data = cleaned_tobac_2007,
lng = ~longitude,
lat = ~latitude,
label = ~location_abbr,
radius = ~data_value * 0.12,
color = "magenta",
stroke = TRUE,
<<<<<<< HEAD
fillOpacity = 0.75,
popup = ~paste("Response:", response))
=======
fillOpacity = 0.1,
popup = ~paste("Response:", response),
group = ~location_abbr)
<<<<<<< HEAD
=======
>>>>>>> c4895062fb48c9bff81bb25130729b55b27dc5c2
>>>>>>> 41ca2b4a46d7b7352482b3a6a81683f51f66edd5
leaflet() %>%
addTiles() %>%
addCircleMarkers(data = cleaned_infant_mortality,
lng = ~longitude,
lat = ~latitude,
label = ~location_abbr,
radius = ~data_value * 0.12,
color = "orange",
stroke = TRUE,
fillOpacity = 0.5,
popup = ~paste("Response:", response))
<<<<<<< HEAD
=======
<<<<<<< HEAD
=======
>>>>>>> c4895062fb48c9bff81bb25130729b55b27dc5c2
>>>>>>> 41ca2b4a46d7b7352482b3a6a81683f51f66edd5
The plot above shows the locations of infant mortality rate across the US.
infant_deaths <- cleaned_infant_mortality %>%
filter(question == "Indicator of infant currently alive" & response == "NO") %>%
group_by(location_desc) %>%
summarize(total_infant_deaths = n())
# Display the table using knitr::kable()
knitr::kable(infant_deaths)
| location_desc | total_infant_deaths |
|---|---|
| Alaska | 45 |
| Arkansas | 45 |
| Colorado | 47 |
| Delaware | 40 |
| Georgia | 43 |
| Hawaii | 45 |
| Illinois | 47 |
| Maine | 42 |
| Maryland | 45 |
| Massachusetts | 44 |
| Michigan | 43 |
| Minnesota | 41 |
| Missouri | 42 |
| Nebraska | 45 |
| New Jersey | 39 |
| New York (excluding NYC) | 47 |
| New York City | 47 |
| North Carolina | 47 |
| Ohio | 46 |
| Oklahoma | 47 |
| Oregon | 46 |
| Pennsylvania | 3 |
| Rhode Island | 46 |
| South Carolina | 47 |
| South Dakota | 43 |
| Utah | 47 |
| Vermont | 47 |
| Washington | 43 |
| West Virginia | 47 |
| Wisconsin | 40 |
| Wyoming | 43 |
The table provides a summary of total infant deaths by state, with
each row representing a specific location. The
location_desc column denotes the state, and the
total_infant_deaths column indicates the corresponding
number of infant deaths in each location. The data suggests variability
in infant mortality rates across different regions, with some areas
reporting higher or lower rates than others. For instance, states like
Pennsylvania have a notably lower count of infant deaths, while others,
such as Alaska and Arkansas, have higher counts. However, most of the
data seemed to stay within the 35 to 50 range. This summary provides an
overview of the distribution of infant deaths across various
geographical locations.
filtered_mortality_race <- cleaned_infant_mortality %>%
filter(break_out_category == "Maternal Race/Ethnicity" &
(break_out %in% c("Hispanic", "Non-hispanic", "White, non-Hispanic")) &
question == "Indicator of infant currently alive" & response == "NO")
# Display the table using knitr::kable()
knitr::kable(filtered_mortality_race)
| year | location_abbr | location_desc | class | topic | question | data_source | response | data_value | low_confidence_limit | high_confidence_limit | sample_size | break_out | break_out_category | latitude | longitude | class_id | topic_id | question_id | location_id | break_out_id | break_out_categoryid | response_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 | UT | Utah | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.9 | 0.3 | 2.7 | 5 | Hispanic | Maternal Race/Ethnicity | 39.36070 | -111.58713 | CLA8 | TOP43 | QUO143 | 49 | ETH2 | BOC6 | RES23 |
| 2007 | OR | Oregon | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.7 | 0.2 | 2.1 | 3 | Hispanic | Maternal Race/Ethnicity | 44.56745 | -120.15503 | CLA8 | TOP43 | QUO143 | 41 | ETH2 | BOC6 | RES23 |
| 2007 | WA | Washington | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.2 | 0.0 | 1.7 | 1 | White, non-Hispanic | Maternal Race/Ethnicity | 47.52228 | -120.47001 | CLA8 | TOP43 | QUO143 | 53 | ETH4 | BOC6 | RES23 |
| 2007 | YC | New York City | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.2 | 0.7 | 10 | Hispanic | Maternal Race/Ethnicity | 42.82700 | -75.54397 | CLA8 | TOP43 | QUO143 | 36 | ETH2 | BOC6 | RES23 |
| 2007 | OH | Ohio | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.3 | 1.4 | 18 | White, non-Hispanic | Maternal Race/Ethnicity | 40.06021 | -82.40426 | CLA8 | TOP43 | QUO143 | 39 | ETH4 | BOC6 | RES23 |
| 2007 | ME | Maine | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | NA | NA | NA | NA | Hispanic | Maternal Race/Ethnicity | 45.25423 | -68.98503 | CLA8 | TOP43 | QUO143 | 23 | ETH2 | BOC6 | RES23 |
| 2007 | MD | Maryland | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.3 | 1.3 | 7 | Hispanic | Maternal Race/Ethnicity | 39.29058 | -76.60926 | CLA8 | TOP43 | QUO143 | 24 | ETH2 | BOC6 | RES23 |
| 2007 | ME | Maine | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.3 | 0.2 | 0.4 | 19 | White, non-Hispanic | Maternal Race/Ethnicity | 45.25423 | -68.98503 | CLA8 | TOP43 | QUO143 | 23 | ETH4 | BOC6 | RES23 |
| 2007 | MA | Massachusetts | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.1 | 2.2 | 2 | Hispanic | Maternal Race/Ethnicity | 42.27687 | -72.08269 | CLA8 | TOP43 | QUO143 | 25 | ETH2 | BOC6 | RES23 |
| 2007 | IL | Illinois | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.2 | 0.6 | 12 | White, non-Hispanic | Maternal Race/Ethnicity | 40.48501 | -88.99771 | CLA8 | TOP43 | QUO143 | 17 | ETH4 | BOC6 | RES23 |
| 2007 | DE | Delaware | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 1.8 | 0.6 | 5.4 | 4 | Hispanic | Maternal Race/Ethnicity | 39.00883 | -75.57774 | CLA8 | TOP43 | QUO143 | 10 | ETH2 | BOC6 | RES23 |
| 2007 | MO | Missouri | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.8 | 0.5 | 1.5 | 18 | White, non-Hispanic | Maternal Race/Ethnicity | 38.63579 | -92.56630 | CLA8 | TOP43 | QUO143 | 29 | ETH4 | BOC6 | RES23 |
| 2007 | AR | Arkansas | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.3 | 0.1 | 1.0 | 2 | Hispanic | Maternal Race/Ethnicity | 34.74865 | -92.27449 | CLA8 | TOP43 | QUO143 | 5 | ETH2 | BOC6 | RES23 |
| 2007 | RI | Rhode Island | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.3 | 0.2 | 0.6 | 5 | Hispanic | Maternal Race/Ethnicity | 41.70828 | -71.52247 | CLA8 | TOP43 | QUO143 | 44 | ETH2 | BOC6 | RES23 |
| 2007 | WV | West Virginia | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | NA | NA | NA | NA | Hispanic | Maternal Race/Ethnicity | 38.66551 | -80.71264 | CLA8 | TOP43 | QUO143 | 54 | ETH2 | BOC6 | RES23 |
| 2007 | UT | Utah | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.5 | 0.2 | 1.0 | 15 | White, non-Hispanic | Maternal Race/Ethnicity | 39.36070 | -111.58713 | CLA8 | TOP43 | QUO143 | 49 | ETH4 | BOC6 | RES23 |
| 2007 | MA | Massachusetts | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.5 | 0.1 | 1.9 | 2 | White, non-Hispanic | Maternal Race/Ethnicity | 42.27687 | -72.08269 | CLA8 | TOP43 | QUO143 | 25 | ETH4 | BOC6 | RES23 |
| 2007 | AR | Arkansas | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.5 | 0.2 | 1.1 | 18 | White, non-Hispanic | Maternal Race/Ethnicity | 34.74865 | -92.27449 | CLA8 | TOP43 | QUO143 | 5 | ETH4 | BOC6 | RES23 |
| 2007 | SD | South Dakota | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | NA | NA | NA | NA | Hispanic | Maternal Race/Ethnicity | 44.35313 | -100.37353 | CLA8 | TOP43 | QUO143 | 46 | ETH2 | BOC6 | RES23 |
| 2007 | HI | Hawaii | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.1 | 2.5 | 1 | White, non-Hispanic | Maternal Race/Ethnicity | 21.30485 | -157.85775 | CLA8 | TOP43 | QUO143 | 15 | ETH4 | BOC6 | RES23 |
| 2007 | VT | Vermont | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | NA | NA | NA | NA | Hispanic | Maternal Race/Ethnicity | 43.62538 | -72.51764 | CLA8 | TOP43 | QUO143 | 50 | ETH2 | BOC6 | RES23 |
| 2007 | MD | Maryland | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.1 | 0.1 | 0.3 | 8 | White, non-Hispanic | Maternal Race/Ethnicity | 39.29058 | -76.60926 | CLA8 | TOP43 | QUO143 | 24 | ETH4 | BOC6 | RES23 |
| 2007 | MN | Minnesota | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 1.1 | 0.2 | 7.4 | 1 | Hispanic | Maternal Race/Ethnicity | 46.35565 | -94.79420 | CLA8 | TOP43 | QUO143 | 27 | ETH2 | BOC6 | RES23 |
| 2007 | IL | Illinois | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.2 | 1.9 | 4 | Hispanic | Maternal Race/Ethnicity | 40.48501 | -88.99771 | CLA8 | TOP43 | QUO143 | 17 | ETH2 | BOC6 | RES23 |
| 2007 | WA | Washington | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.2 | 0.0 | 1.3 | 1 | Hispanic | Maternal Race/Ethnicity | 47.52228 | -120.47001 | CLA8 | TOP43 | QUO143 | 53 | ETH2 | BOC6 | RES23 |
| 2007 | NY | New York (excluding NYC) | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.1 | 1.0 | 4 | Hispanic | Maternal Race/Ethnicity | 42.82700 | -75.54397 | CLA8 | TOP43 | QUO143 | 36 | ETH2 | BOC6 | RES23 |
| 2007 | OR | Oregon | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.2 | 1.7 | 18 | White, non-Hispanic | Maternal Race/Ethnicity | 44.56745 | -120.15503 | CLA8 | TOP43 | QUO143 | 41 | ETH4 | BOC6 | RES23 |
| 2007 | NC | North Carolina | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.7 | 0.3 | 1.3 | 9 | Hispanic | Maternal Race/Ethnicity | 35.46622 | -79.15925 | CLA8 | TOP43 | QUO143 | 37 | ETH2 | BOC6 | RES23 |
| 2007 | NJ | New Jersey | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.2 | 0.1 | 0.7 | 3 | White, non-Hispanic | Maternal Race/Ethnicity | 40.13057 | -74.27369 | CLA8 | TOP43 | QUO143 | 34 | ETH4 | BOC6 | RES23 |
| 2007 | NY | New York (excluding NYC) | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.3 | 1.4 | 19 | White, non-Hispanic | Maternal Race/Ethnicity | 42.82700 | -75.54397 | CLA8 | TOP43 | QUO143 | 36 | ETH4 | BOC6 | RES23 |
| 2007 | MI | Michigan | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.5 | 0.3 | 1.1 | 12 | White, non-Hispanic | Maternal Race/Ethnicity | 44.66132 | -84.71439 | CLA8 | TOP43 | QUO143 | 26 | ETH4 | BOC6 | RES23 |
| 2007 | NE | Nebraska | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.1 | 2.3 | 1 | Hispanic | Maternal Race/Ethnicity | 41.64104 | -99.36572 | CLA8 | TOP43 | QUO143 | 31 | ETH2 | BOC6 | RES23 |
| 2007 | CO | Colorado | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.3 | 1.1 | 24 | White, non-Hispanic | Maternal Race/Ethnicity | 38.84384 | -106.13361 | CLA8 | TOP43 | QUO143 | 8 | ETH4 | BOC6 | RES23 |
| 2007 | YC | New York City | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.2 | 1.7 | 8 | White, non-Hispanic | Maternal Race/Ethnicity | 42.82700 | -75.54397 | CLA8 | TOP43 | QUO143 | 36 | ETH4 | BOC6 | RES23 |
| 2007 | NE | Nebraska | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.2 | 0.0 | 1.1 | 1 | White, non-Hispanic | Maternal Race/Ethnicity | 41.64104 | -99.36572 | CLA8 | TOP43 | QUO143 | 31 | ETH4 | BOC6 | RES23 |
| 2007 | WY | Wyoming | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.2 | 0.7 | 7 | White, non-Hispanic | Maternal Race/Ethnicity | 43.23554 | -108.10983 | CLA8 | TOP43 | QUO143 | 56 | ETH4 | BOC6 | RES23 |
| 2007 | DE | Delaware | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.2 | 0.1 | 0.7 | 2 | White, non-Hispanic | Maternal Race/Ethnicity | 39.00883 | -75.57774 | CLA8 | TOP43 | QUO143 | 10 | ETH4 | BOC6 | RES23 |
| 2007 | WI | Wisconsin | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.1 | 1.8 | 2 | White, non-Hispanic | Maternal Race/Ethnicity | 44.39319 | -89.81637 | CLA8 | TOP43 | QUO143 | 55 | ETH4 | BOC6 | RES23 |
| 2007 | CO | Colorado | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.2 | 0.9 | 11 | Hispanic | Maternal Race/Ethnicity | 38.84384 | -106.13361 | CLA8 | TOP43 | QUO143 | 8 | ETH2 | BOC6 | RES23 |
| 2007 | GA | Georgia | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.3 | 0.1 | 0.7 | 5 | White, non-Hispanic | Maternal Race/Ethnicity | 32.83968 | -83.62758 | CLA8 | TOP43 | QUO143 | 13 | ETH4 | BOC6 | RES23 |
| 2007 | AK | Alaska | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.2 | 1.6 | 12 | White, non-Hispanic | Maternal Race/Ethnicity | 64.84508 | -147.72206 | CLA8 | TOP43 | QUO143 | 2 | ETH4 | BOC6 | RES23 |
| 2007 | RI | Rhode Island | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.5 | 0.3 | 1.1 | 18 | White, non-Hispanic | Maternal Race/Ethnicity | 41.70828 | -71.52247 | CLA8 | TOP43 | QUO143 | 44 | ETH4 | BOC6 | RES23 |
| 2007 | NC | North Carolina | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.8 | 0.3 | 1.7 | 20 | White, non-Hispanic | Maternal Race/Ethnicity | 35.46622 | -79.15925 | CLA8 | TOP43 | QUO143 | 37 | ETH4 | BOC6 | RES23 |
| 2007 | MN | Minnesota | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.3 | 0.1 | 1.0 | 4 | White, non-Hispanic | Maternal Race/Ethnicity | 46.35565 | -94.79420 | CLA8 | TOP43 | QUO143 | 27 | ETH4 | BOC6 | RES23 |
| 2007 | SC | South Carolina | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.2 | 0.1 | 0.3 | 6 | Hispanic | Maternal Race/Ethnicity | 33.99882 | -81.04537 | CLA8 | TOP43 | QUO143 | 45 | ETH2 | BOC6 | RES23 |
| 2007 | SC | South Carolina | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.7 | 0.3 | 2.0 | 46 | White, non-Hispanic | Maternal Race/Ethnicity | 33.99882 | -81.04537 | CLA8 | TOP43 | QUO143 | 45 | ETH4 | BOC6 | RES23 |
| 2007 | OH | Ohio | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 5.7 | 0.8 | 31.2 | 1 | Hispanic | Maternal Race/Ethnicity | 40.06021 | -82.40426 | CLA8 | TOP43 | QUO143 | 39 | ETH2 | BOC6 | RES23 |
| 2007 | WV | West Virginia | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 1.0 | 0.5 | 1.9 | 31 | White, non-Hispanic | Maternal Race/Ethnicity | 38.66551 | -80.71264 | CLA8 | TOP43 | QUO143 | 54 | ETH4 | BOC6 | RES23 |
| 2007 | OK | Oklahoma | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.3 | 0.2 | 0.5 | 13 | Hispanic | Maternal Race/Ethnicity | 35.47203 | -97.52107 | CLA8 | TOP43 | QUO143 | 40 | ETH2 | BOC6 | RES23 |
| 2007 | HI | Hawaii | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.7 | 0.2 | 2.7 | 2 | Hispanic | Maternal Race/Ethnicity | 21.30485 | -157.85775 | CLA8 | TOP43 | QUO143 | 15 | ETH2 | BOC6 | RES23 |
| 2007 | VT | Vermont | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.6 | 0.3 | 1.2 | 11 | White, non-Hispanic | Maternal Race/Ethnicity | 43.62538 | -72.51764 | CLA8 | TOP43 | QUO143 | 50 | ETH4 | BOC6 | RES23 |
| 2007 | OK | Oklahoma | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.4 | 0.3 | 0.5 | 73 | White, non-Hispanic | Maternal Race/Ethnicity | 35.47203 | -97.52107 | CLA8 | TOP43 | QUO143 | 40 | ETH4 | BOC6 | RES23 |
| 2007 | NJ | New Jersey | Infant Health | Pregnancy Outcome | Indicator of infant currently alive | PRAMS | NO | 0.9 | 0.3 | 2.7 | 3 | Hispanic | Maternal Race/Ethnicity | 40.13057 | -74.27369 | CLA8 | TOP43 | QUO143 | 34 | ETH2 | BOC6 | RES23 |
view(filtered_mortality_race)
plot_infant_deaths <- ggplot(filtered_mortality_race, aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Ethnicity",
x = "Ethnicity",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("Hispanic" = "blue", "Non-hispanic" = "green", "White, non-Hispanic" = "pink")) +
theme_minimal()
print(plot_infant_deaths)

The plot_infant_deaths above shows a plot of infant
deaths categorized by whether they were Hispanic or not. The graph shows
that those who were not Hispanic had a higher infant death count than
those who were Hispanic.
#Plot of Infant Mortality and Maternal Income
filtered_mortality_income <- cleaned_infant_mortality %>%
filter(break_out_category == "Income (years 2004 and beyond)" &
(break_out %in% c("Less than $10,000", "$10,000 to $24,999", "$25,000 to $49,999", "$50,000 or more")) &
question == "Indicator of infant currently alive" & response == "NO")
view(filtered_mortality_income)
plot_infant_income <- ggplot(filtered_mortality_income, aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Income",
x = "Maternal Income",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("Less than $10,000" = "blue", "$10,000 to $24,999" = "red", "$25,000 to $49,999" = "purple", "$50,000 or more" = "pink")) +
theme_minimal()
print(plot_infant_income)

filtered_mortality_age <- cleaned_infant_mortality %>%
filter(break_out_category == "Maternal Age - 18 to 44 years in groupings" &
(break_out %in% c("Age < 18", "Age 18 - 24", "Age 25 - 29", "Age 30 - 44", "Age 45+")) &
question == "Indicator of infant currently alive" & response == "NO")
plot_mortality_age <- ggplot(filtered_mortality_age, aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Maternal Age",
x = "Maternal Age",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("Age < 18" = "blue", "Age 18 - 24" = "purple", "Age 25 - 29" = "pink", "Age 30 - 44" = "yellow", "Age 45+" = "orange")) +
theme_minimal()
print(plot_mortality_age)

filtered_mortality_educ <- cleaned_infant_mortality %>%
filter(break_out_category == "Maternal Education" &
(break_out %in% c("<12 yrs", "12 yrs", ">12 yrs")) &
question == "Indicator of infant currently alive" & response == "NO")
plot_mortality_educ <- filtered_mortality_educ |>
ggplot(aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Maternal Education",
x = "Maternal Education",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("<12 yrs" = "blue", "12 yrs" = "purple", ">12 yrs" = "pink")) +
theme_minimal()
print(plot_mortality_educ)

filtered_mortality_medi <- cleaned_infant_mortality %>%
filter(break_out_category == "Medicaid Recipient" &
(break_out %in% c("Non-Medicaid", "Medicaid")) &
question == "Indicator of infant currently alive" & response == "NO")
plot_mortality_medi <- filtered_mortality_medi |>
ggplot(aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Medicaid Recpient",
x = "Medicaid Recepient",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("Non-Medicaid" = "blue", "Medicaid" = "purple")) +
theme_minimal()
print(plot_mortality_medi)

filtered_mortality_smoke <- cleaned_infant_mortality %>%
filter(break_out_category == "Smoked last 3 months of Pregnancy" &
(break_out %in% c("Non-Smoker", "Smoker")) &
question == "Indicator of infant currently alive" & response == "NO")
plot_mortality_smoke <- filtered_mortality_smoke |>
ggplot(aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Maternal Smoking",
x = "Maternal Smoking Status",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("Non-Smoker" = "pink", "Smoker" = "yellow")) +
theme_minimal()
print(plot_mortality_smoke)

filtered_mortality_intent <- cleaned_infant_mortality %>%
filter(break_out_category == "Pregnancy Intendedness" &
(break_out %in% c("Unintended", "Intended")) &
question == "Indicator of infant currently alive" & response == "NO")
plot_mortality_intent <- filtered_mortality_intent |>
ggplot(aes(x = break_out, fill = break_out)) +
geom_bar() +
labs(title = "Infant Deaths by Maternal Intent",
x = "Maternal Intent",
y = "Total Infant Deaths") +
scale_fill_manual(values = c("Unintended" = "orange", "Intended" = "red")) +
theme_minimal()
print(plot_mortality_intent)

#merged_data <- left_join(cleaned_alc_2007, cleaned_infant_mortality, by = "year") %>%
# select(location_abbr.x, location_abbr.y, location_desc.x, location_desc.y, topic.x, #topic.y, question.x, response.x, class.y, topic.y, question.y, break_out_category.y, #response.y)